<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<style>
    div[lay-id="datalist"] .layui-table-cell{
        height:auto !important;
    };
</style>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>
    var param_id = getQueryVariable('id') || 0;
    var param_accname = decodeURI(getQueryVariable('accname') || '') || '';

    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;

        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });

        setSouTableExport('资金日报表');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_accday_show),where: {id:param_id, accname:param_accname}, page: false, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text,totalRow: true
            ,parseData: function (res) {

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.total,
                    "data": res.data.data
                };
            }
            , cols: [
                [
                    {type:'numbers',title:'序号',rowspan:2}
                    ,{field: 'accname_zhang', title: '资金账户',rowspan:2}
                    ,{field: 'kainame', title: '开户行',rowspan:2}
                    ,{field: 'dt', title: '交易日期',rowspan:2}
                    ,{field: 'duier', title: '交易对象',rowspan:2}
                    ,{field: 'kuanlei', title: '款项类型',rowspan:2}
                    ,{field: 'zhai', title: '款项摘要',rowspan:2}
                    ,{field: 'enginname', title: '工程名称',rowspan:2}
                    ,{field: 'gui_unit', title: '业务归属',rowspan:2}
                    ,{field:'shangmoney',title:'上日余额(元)',totalRow: true,rowspan:2,templet: function(d){return parseFormatNum(d.shangmoney);}}
                    ,{field: '', title: '本日发生额(元)',colspan:2,align:'center'}
                    ,{field:'todaymoney',title:'本日余额(元)',totalRow: true,rowspan:2,templet: function(d){return parseFormatNum(d.todaymoney);}}
                    // ,{field: '', title: '是否开具增值税发票',colspan:2,align:'center'}
                    ,{field: 'explain', title: '备注',rowspan:2}
                ],
                [
                    {field:'shoufee',title:'转入(贷方)',totalRow: true,templet: function(d){return parseFormatNum(d.shoufee);}}
                    ,{field:'zhifee',title:'转出(借方)',totalRow: true,templet: function(d){return parseFormatNum(d.zhifee);}}

                    // ,{field: '', title: '开具时间', templet:function(e){
                    //     var str = '';
                    //     for (var key in e.piao){
                    //         str += e.piao[key].piaodt+'<br/>';
                    //     }
                    //     return str;
                    // }}
                    // ,{field: '', title: '开具金额(元)', templet:function(e){
                    //     var str = 0;
                    //     for (var key in e.piao){
                    //         str += e.piao[key].piaomoney+'<br/>';
                    //     }
                    //     return parseFormatNum(str);
                    // }}
                ]
            ]
            , done: function (res) {
                soulTable.render(this);

                // 处理列表fixed的高度问题
                $('div[lay-id="datalist"] .layui-table-main>table>tbody>tr').each(function (i) {
                    var height = $(this).height();
                    $('div[lay-id="datalist"] .layui-table-fixed-l>.layui-table-body>table>tbody>tr')
                        .eq(i).css('cssText','height:'+height+'px !important');
                    $('div[lay-id="datalist"] .layui-table-fixed-r>.layui-table-body>table>tbody>tr')
                        .eq(i).css('cssText','height:'+height+'px !important');
                });
            }
        });
        listTableSearch(form, table);
    });



</script>
</body>
</html>
